import 'package:xin_nuo_pda/bean/user_entity.dart';

userEntityFromJson(UserEntity data, Map<String, dynamic> json) {
	if (json['LOGINRESULT'] != null) {
		data.lOGINRESULT = json['LOGINRESULT'];
	}
	if (json['USER'] != null) {
		data.uSER = UserInfo().fromJson(json['USER']);
	}
	return data;
}

Map<String, dynamic> userEntityToJson(UserEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['LOGINRESULT'] = entity.lOGINRESULT;
	data['USER'] = entity.uSER.toJson();
	return data;
}

userInfoFromJson(UserInfo data, Map<String, dynamic> json) {
	if (json['USERNAME'] != null) {
		data.uSERNAME = json['USERNAME'].toString();
	}
	if (json['DESCRIPTION'] != null) {
		data.dESCRIPTION = json['DESCRIPTION'].toString();
	}
	if (json['DEFAULTLANGUAGE'] != null) {
		data.dEFAULTLANGUAGE = json['DEFAULTLANGUAGE'].toString();
	}
	if (json['DEFAULTORGRRN'] != null) {
		data.dEFAULTORGRRN = json['DEFAULTORGRRN'] is String
				? int.tryParse(json['DEFAULTORGRRN'])
				: json['DEFAULTORGRRN'].toInt();
	}
	if (json['ISCLIENTENCRY'] != null) {
		data.iSCLIENTENCRY = json['ISCLIENTENCRY'].toString();
	}
	return data;
}

Map<String, dynamic> userInfoToJson(UserInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['USERNAME'] = entity.uSERNAME;
	data['DESCRIPTION'] = entity.dESCRIPTION;
	data['DEFAULTLANGUAGE'] = entity.dEFAULTLANGUAGE;
	data['DEFAULTORGRRN'] = entity.dEFAULTORGRRN;
	data['ISCLIENTENCRY'] = entity.iSCLIENTENCRY;
	return data;
}

authorityEntityFromJson(AuthorityEntity data, Map<String, dynamic> json) {
	if (json['AUTHORITYLIST'] != null) {
		data.authoritylist = (json['AUTHORITYLIST'] as List).map((v) => AuthorityInfo().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> authorityEntityToJson(AuthorityEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['AUTHORITYLIST'] =  entity.authoritylist.map((v) => v.toJson()).toList();
	return data;
}

authorityInfoFromJson(AuthorityInfo data, Map<String, dynamic> json) {
	if (json['OBJECTRRN'] != null) {
		data.objectrrn = json['OBJECTRRN'].toString();
	}
	if (json['NAME'] != null) {
		data.name = json['NAME'].toString();
	}
	if (json['AUTHORITYTYPE'] != null) {
		data.authoritytype = json['AUTHORITYTYPE'].toString();
	}
	if (json['PARENTRRN'] != null) {
		data.parentrrn = json['PARENTRRN'] is String
				? int.tryParse(json['PARENTRRN'])
				: json['PARENTRRN'].toInt();
	}
	if (json['SEQNO'] != null) {
		data.seqno = json['SEQNO'].toString();
	}
	if (json['LABEL'] != null) {
		data.label = json['LABEL'].toString();
	}
	if (json['LABELZH'] != null) {
		data.labelzh = json['LABELZH'].toString();
	}
	return data;
}

Map<String, dynamic> authorityInfoToJson(AuthorityInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['OBJECTRRN'] = entity.objectrrn;
	data['NAME'] = entity.name;
	data['AUTHORITYTYPE'] = entity.authoritytype;
	data['PARENTRRN'] = entity.parentrrn;
	data['SEQNO'] = entity.seqno;
	data['LABEL'] = entity.label;
	data['LABELZH'] = entity.labelzh;
	return data;
}